package xdu.lz.stage1_basic.chapter2_api.b_stackSize;

public class Code02_ThreadStackSize2 {
    private static int counter = 0;

    public static void main(String[] args) {

        new Thread(null,new Runnable() {
            @Override
            public void run() {
                try {
                    add(0);
                } catch (Error e) {
                    e.printStackTrace();
                    System.out.println("入虚拟机栈次数:"+counter);
                }
            }
            public void add(int i){
                ++counter;
                add(i+1);
            }
        },"thread",1<<32).start();
    }
}
